package controller;

import service.ManageService;
import view.SelfManageView;

import javax.swing.*;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;

public class SelfManageClickListener implements MouseListener {
    private JTable table;
    private SelfManageView selfManageView;
    public SelfManageClickListener(SelfManageView selfManageView){
        this.selfManageView = selfManageView;

    }
    @Override
    public void mouseClicked(MouseEvent e) {
        int selRow = table.getSelectedRow();
        String bookId = table.getValueAt(selRow,0).toString().trim();
        String bookName = table.getValueAt(selRow,1).toString().trim();
        selfManageView.getJLabel3().setText(bookId);
        selfManageView.getJLabel4().setText(bookName);
        selfManageView.refresh();
        ManageService manageService=new ManageService();
    }

    @Override
    public void mousePressed(MouseEvent e) {

    }

    @Override
    public void mouseReleased(MouseEvent e) {

    }

    @Override
    public void mouseEntered(MouseEvent e) {

    }

    @Override
    public void mouseExited(MouseEvent e) {

    }

    public void setTable(JTable table) {
        this.table=table;
    }
}
